<?php

namespace App\Models;


class GoodsOrder extends Orm
{
    protected $table = 'goods_order';
    protected $dateFormat = 'U';
    public $timestamps = true;

    protected $casts = [
        'goods_snap' => 'json'
    ];

    public function shopInfo()
    {
        return $this->belongsTo(Shop::class, 'shop_id');
    }

    public function userInfo()
    {
        return $this->belongsTo(Users::class, 'user_id');
    }

    public function getPublishAttribute()
    {
        return date('Y-m-d',$this->attributes['publish']);
    }

}
